import  { lazy, ReactNode } from "react";
const Login = lazy(() => import("../pages/Login"));
const Page404 = lazy(() => import("../pages/page404"));
const Dashboard = lazy(() => import("../pages/index/Dashboard"));
const DateChart = lazy(() => import("../pages/index/DataChart"));
const UserList = lazy(() => import("../pages/index/userList"));
const Cat = lazy(() => import("../pages/index/cat/index"));
const ReduxDome = lazy(() => import("../pages/reduxx/index"));
const Practice = lazy(() => import("../pages/practice/index"));



interface routerModel {
  path: string,
  title: string,
  key: string,
  //加一个精确匹配
  exact?: boolean,
  component?: ReactNode,
  children?: routerModel[]
}

export const router :routerModel[] = [
  {
    path: "/admin/dashboard",
    title: "首页",
    exact: true,
    key: "dashboard",
    component: <Dashboard/>
  },
  {
    path: "/admin/DataChart",
    title: "数据图表",
    exact: true,
    key: "dateChart",
    component: <DateChart/>
  },
  {
    path: "/admin/UserList",
    title: "用户列表",
    exact: true,
    key: "UserList",
    component: <UserList/>
  },
  {
    path: "/admin/cat",
    title: "貓",
    exact: true,
    key: "cat",
    component: <Cat/>
  },
  {
    path: "/admin/redux",
    title: "redux",
    exact: true,
    key: "redux",
    component: <ReduxDome/>
  },
  {
    path: "/admin/practice",
    title: "练习",
    exact: true,
    key: "practice",
    component: <Practice/>
  },
]

export const unAuthRouter :routerModel[] = [
  {
    path: "/login",
    title: "登录",
    key: "login",
    component: <Login/>
  },
  {
    path: "*",
    title: "404",
    exact: false,
    key: "404",
    component: <Page404/>
  }
]

